Alibaba Arthas 发表于 2020-05-25 | 分类于 Arthas | | 阅读次数: 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081文档地址[https://alibaba.github.io/arthas/advanced-use.html]$ curl -O https://alibaba.github.io/arthas/arthas-boot.jar#Demo进程是第2个,则输入2,再输入回车/enter。Arthas会attach到目标进程上,并输出日志$ java -jar arthas-boot.jar* [1]: 35542 [2]: 71560 arthas-demo.jar [INFO] Try to attach process 71560[INFO] Attach process 71560 success.[INFO] arthas-client connect 127.0.0.1 3658 ,---. ,------. ,--------.,--. ,--. ,---. ,---. / O \ | .--. ''--. .--'| '--' | / O \ ' .-'| .-. || '--'.' | | | .--. || .-. |`. `-.| | | || |\ \ | | | | | || | | |.-' |`--' `--'`--' '--' `--' `--' `--'`--' `--'`-----' wiki: https://alibaba.github.io/arthasversion: 3.0.5.20181127201536pid: 71560time: 2018-11-28 19:16:24#当前系统的实时数据面板$ dashboard #arthas-demo进程的Main Class $ thread 1 | grep 'main(' at demo.MathGame.main(MathGame.java:17)#反编译python$ jad demo.MathGame #通过watch命令来查看demo.MathGame#primeFactors函数的返回值 $ watch demo.MathGame primeFactors returnObj #返回当前的工作目录,和linux命令类似 $ pwd /data/alpha-market/jars #查看当前会话的信息 $ session Name Value -------------------------------------------------- JAVA_PID 7276 SESSION_ID 8af7f372-0c5d-4d6a-972b-33840aa6d2fb # 打印命令历史 $ history 1 dashboard 2 dashboard 3 thread 1 | grep 'main(' 4 jad demo.MathGame 5 watch demo.MathGame primeFactors returnObj 6 jvm #关闭 Arthas 服务端,所有 Arthas 客户端全部退出$ stop #查看当前 JVM 的线程堆栈信息$ thread Threads Total: 90, NEW: 0, RUNNABLE: 21, BLOCKED: 0, WAITING: 44, TIMED_WAITING: 25, TERMINATED: 0 ID NAME GROUP PRIORITY STATE %CPU TIME INTERRUPTED DAEMON 75 Thread-2 main 5 RUNNABLE 29 4:12 false false 1511 as-command-execute-daemon system 10 RUNNABLE 20 0:0 false true 82 SendDepth-pool-2 main 5 RUNNABLE 17 28:22 false false 79 Thread-4 main 5 TIMED_WAITING 14 12:20 false false 1456 task-56 main 5 TIMED_WAITING 4 0:1 false false 1453 task-53 main 5 TIMED_WAITING 3 0:1 false false 1454 task-54 main 5 TIMED_WAITING 3 0:1 false fal #查看当前 JVM 的信息$ jvm#通过getstatic命令可以方便的查看类的静态属性$ getstatic com.alpha.market.service.impl.QueryServiceImpl logger 打赏 微信支付 支付宝